<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="tx.bj12320.model.*" %>
<%@ include file="/commons/taglibs.jsp" %>

<rapid:override name="head">
	<script type="text/javascript">
	/** 控制能加10个附件**/
var file5=0;
function addsRepOneRow(tableID){

	if(file5<5){
		file5=file5+1;
$('#'+tableID+' #modelRow').clone().insertAfter($('#'+tableID+' tr:last-child')).show();
	}else{
		alert("只能添加5个附件！");
	}
}
function delsRepOneRow(obj){
	file5=file5-1;
	var row = jQuery(obj).parent().parent();
	$(row).remove();
}
</script>
	<script charset="utf-8" src="<c:url value="/widgets/kindeditor/kindeditor.js"/>" ></script>
	<link rel="stylesheet" type="text/css" href="<c:url value="/widgets/jquery-easyui/themes/default/easyui.css"/>">
	<link rel="stylesheet" type="text/css" href="<c:url value="/widgets/jquery-easyui/themes/icon.css"/>">
	<script src="${ctx }/scripts/jquery.selectboxes.js"></script>
	<script type="text/javascript" src="<c:url value="/widgets/jquery-easyui/jquery.easyui.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/widgets/jquery-easyui/easyloader.js"/>"></script>
	<script>
	KE.show({
		id : 'infoContent'
	});




	using('dialog', function(){
			$('#reportUnitInfoSelect').dialog({
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
						$('#reportUnitInfoSelect').dialog('close');
					}
				}]
			});
		});

	function selectReportUnitInfo(){
		$('#reportUnitInfoSelect').dialog('open');
	}

	function addReportUnitInfo(reportUnitId,unitName){

		$("#reportUnit_select").addOption(reportUnitId,unitName);
	}
	function delReportUnitInfo(){
	$("#reportUnit_select").removeOption(/./,true);
}


		</script>
</rapid:override>

<rapid:override name="content">

	<s:form action="/pages/Infoissue/mail_save.do" method="post" enctype="multipart/form-data" >

		<table class="formTable">

	<s:hidden id="infoissueId" name="infoissueId" />

<!-- ONGL access static field: @package.class@field or @vs@field -->

	  <tr>
		 <td class="tdLabel">用户名:</td>
		 <td>
		 <s:property value="%{userInSession_name}"/></td>
	 </tr>
	<s:textfield label="%{@tx.bjmdr.model.Infoissue@ALIAS_INFO_TITLE}" key="mail_infoTitle" value="%{replymail}" cssClass="" required="false" />
	<tr>
		<td class="tdLabel">
			<%=Infoissue.ALIAS_ISSUE_DATE%>:
		</td>
		<td>
		<input value="${share_current_request_date}" onclick="WdatePicker({dateFmt:'<%=Infoissue.FORMAT_ISSUE_DATE%>'})" id="issueDateString" name="mail_issueDateString"  maxlength="0" class="" />
		</td>
	</tr>

	<tr>
		<td class="tdLabel">
			<%=Infoissue.ALIAS_INFO_CONTENT%>:
		</td>
		<td>
	<s:textarea rows="20" cols="80" name="mail_infoContent" id="infoContent" value="%{model.infoContent}" theme="simple"/>
		</td>
	</tr>

	<tr>
	<td></td>
	  <td>
<table id="attachmentTable" width="100%">
					<tr>
						<td width="30%">附件名称</td>
						<td width="60%">附件路径(文件大小不能超过1M)</td>
						<td width="10%"><input type="button" value="添加附件" onClick="addsRepOneRow('attachmentTable')" /></td>
					</tr>
					<tr id="modelRow" >
						<td><s:textfield label="%{@tx.bjmdr.model.Infoissue@ALIAS_ATTACHMENT_NAME}" key="attachmentNames" theme="simple"/> </td>
						<td> <s:file label="%{@tx.bjmdr.model.SupReportAttachment@ALIAS_ATTACHMENT_FILE}" key="attachmentFiles"   theme="simple"/></td>
						<td><input type='button' value='删除' onclick='delsRepOneRow(this)' /></td>
					</tr>
				</table>
</TD></TR>


	 <sec:authorize ifAnyGranted="ROLE_USER,ROLE_USER_REGION">
	 <c:choose>

	  <c:when test="${not empty replymail}">
	  <tr>
				<td nowrap="nowrap" align="right">发送单位&nbsp;
				</td>
				<td>
						 <select multiple="multiple" id="reportUnit_select" name="reportUnit_select"
						style="width: 60%;" size="6" ><option value='<c:out value='${model.reportUnitInfo.reportUnitId}'/>' selected="selected" ><c:out value='${model.reportUnitInfo.unitName}'/> </option>   </select>
				</td>

	 </tr>
	 </c:when>
	<c:otherwise>
			<tr>  <td nowrap="nowrap" align="right"> 发送单位&nbsp; </td>
				  <td>
                     <input type="button" value="选择上报单位" onclick="selectReportUnitInfo()" />
					<select multiple="multiple" id="reportUnit_select" name="reportUnit_select"
						style="width: 60%;" size="6" >  </select>
					<input type="button" value="删除" onclick="delReportUnitInfo()" />
                  </td>
			 </tr>
		</c:otherwise>
	</c:choose>

	  </sec:authorize>

 <sec:authorize ifAnyGranted="ROLE_REPORT_UNIT">

			<tr>
													<td nowrap="nowrap" align="right">
														发送单位&nbsp;
													</td>
													<td>


					<select multiple="multiple" id="reportUnit_select" name="reportUnit_select"
						style="width: 60%;" size="6" >
						 <option value='1' selected="selected" >北京市不良反应检测中心 </option>
					</select>

													</td>
												</tr>

	  </sec:authorize>

		<tr><td> </td>
		<td>
	    <input id="submitButton" name="submitButton" type="submit" value="提交" />

		<input type="button" value="后退" onclick="history.back();"/>
		</td></tr>

</TABLE>
	</s:form>

	<script>

		new Validation(document.forms[0],{onSubmit:true,onFormValidate : function(result,form) {
			var finalResult = result;

			//在这里添加自定义验证
		$("#reportUnit_select").selectOptions(/./);

			return disableSubmit(finalResult,'submitButton');
		}});
	</script>
	<div id="reportUnitInfoSelect" resizable="true" class="easyui-dialog" icon="icon-search" style="padding:5px;width:620px;height:500px;overflow:false;" closed="true" modal="true" title="选择上报单位">
<iframe name="rightFrame" width="100%" height="100%" src="${ctx}/pages/ReportUnitInfo/listSelect.do" frameborder="0" scrolling="false"></iframe>
</div>
</rapid:override>

<%@ include file="base.jsp" %>